Skip to content

CursorEdit

Base classes

Name Children Inherits
EnumComboBox
prettyqt.custom_widgets.editors.enumcombobox
ComboBox presenting options from a python Enum.

⋔ Inheritance diagram

graph TD
  842151856["custom_widgets.CursorEdit"]
  3843784251["custom_widgets.EnumComboBox"]
  2460391555["widgets.ComboBox"]
  1955118198["widgets.ComboBoxMixin"]
  829357528["widgets.WidgetMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  625385617["gui.PaintDeviceMixin"]
  1844689747["QtWidgets.QComboBox"]
  3620195106["QtWidgets.QWidget"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  673956333["QtGui.QPaintDevice"]
  3843784251 --> 842151856
  2460391555 --> 3843784251
  1955118198 --> 2460391555
  829357528 --> 1955118198
  3227531497 --> 829357528
  2751680898 --> 3227531497
  625385617 --> 829357528
  2751680898 --> 625385617
  1844689747 --> 2460391555
  3620195106 --> 1844689747
  3984060476 --> 3620195106
  37984305 --> 3984060476
  2751680898 --> 37984305
  673956333 --> 3620195106
  37984305 --> 673956333

🛈 DocStrings

Bases: EnumComboBox

Source code in prettyqt/custom_widgets/editors/cursoredit.py
class CursorEdit(custom_widgets.EnumComboBox):
    value_changed = core.Signal(gui.Cursor)

    def __init__(self, *args, object_name: str = "cursor_edit", **kwargs):
        super().__init__(*args, object_name=object_name, **kwargs)
        self._set_enum_class(constants.CursorShape)
        self.currentIndexChanged.connect(self._on_value_change)

    def _on_value_change(self):
        self._value = self.get_value()
        self.value_changed.emit(self._value)

    def get_value(self) -> gui.Cursor:
        shape = super().get_value()
        return gui.Cursor(shape)

    def set_value(self, value: gui.Cursor):
        super().set_value(value.shape())

    value = core.Property(
        gui.Cursor,
        get_value,
        set_value,
        user=True,
        doc="Currently selected cursor",
    )

:fa-brands-github: Show source on GitHub